*============================================================*
set more off
*============================================================*

use Table2_3_6_A1.dta,clear
svyset PSU [pw=wgh], strata(metastrata) singleunit(cer)

*=============================================================================*
*=== Table 2 panel A =========================================================*
*=============================================================================*

*=== Farmer ===*

preserve
keep if seclass <= 13 & treat == 1 & year == 2000
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd

restore 
preserve
keep if seclass <= 13 & treat == 1 & year == 2004
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd
restore

*=== Enterpreneurs, trade and indusgtry ===*

preserve
keep if seclass >= 21 & seclass <= 22 & treat == 1 & year == 2000
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd

restore 
preserve
keep if seclass >= 21 & seclass <= 22 & treat == 1 & year == 2004
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd
restore

*=== Other work status ===*

preserve
keep if ((seclass >= 50 & seclass <= 60) | (seclass == 32) | (seclass == 41 ) ) & treat == 1 & year == 2000
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd

restore 
preserve
keep if ((seclass >= 50 & seclass <= 60) | (seclass == 32) | (seclass == 41 ) ) & treat == 1 & year == 2004
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd
restore

*=== Economically inactive households ===*

preserve
keep if seclass == 71 & treat == 1 & year == 2000
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd

restore 
preserve
keep if seclass == 71 & treat == 1 & year == 2004
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd
restore

*=== Control ===*

preserve
keep if treat == 0 & year == 2000
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd

restore 
preserve
keep if treat == 0 & year == 2004
svy : mean income saving NF_exp medical_exp mediratio Hsex h_age size
estat sd
restore


*=============================================================================*
*=== Table 2 panel B =========================================================*
*=============================================================================*

*=== Farmer ===*

preserve
keep if seclass <= 13 & treat == 1 & year == 2000 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd

restore 
preserve
keep if seclass <= 13 & treat == 1 & year == 2004 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd
restore

*=== Enterpreneurs, trade and indusgtry ===*

preserve
keep if seclass >= 21 & seclass <= 22 & treat == 1 & year == 2000 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd

restore 
preserve
keep if seclass >= 21 & seclass <= 22 & treat == 1 & year == 2004 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd
restore

*=== Other work status ===*

preserve
keep if ((seclass >= 50 & seclass <= 60) | (seclass == 32) | (seclass == 41 ) ) & treat == 1 & year == 2000 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd

restore 
preserve
keep if ((seclass >= 50 & seclass <= 60) | (seclass == 32) | (seclass == 41 ) ) & treat == 1 & year == 2004 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd
restore

*=== Economically inactive households ===*

preserve
keep if seclass == 71 & treat == 1 & year == 2000 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd

restore 
preserve
keep if seclass == 71 & treat == 1 & year == 2004 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd
restore

*=== Control ===*

preserve
keep if treat == 0 & year == 2000 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd

restore 
preserve
keep if treat == 0 & year == 2004 & medical_exp > 0
svy : mean medical_exp mediratio 
estat sd
restore


*=============================================================================*
*=== Table 3 =================================================================*
*=============================================================================*

*=== Farmer ===*

preserve
keep if seclass <= 13 & treat == 1 & year == 2000
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2000
mfx
svy : logit CP30 income_thu  if year == 2000
mfx

restore 

preserve
keep if seclass <= 13 & treat == 1 & year == 2004
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2004
mfx
svy : logit CP30 income_thu  if year == 2004
mfx

restore

*=== Enterpreneurs, trade and indusgtry ===*

preserve
keep if seclass >= 21 & seclass <= 22 & treat == 1 & year == 2000
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2000
mfx
svy : logit CP30 income_thu  if year == 2000
mfx

restore 

preserve
keep if seclass >= 21 & seclass <= 22 & treat == 1 & year == 2004
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2004
mfx
svy : logit CP30 income_thu  if year == 2004
mfx

restore

*=== Other work status ===*

preserve
keep if ((seclass >= 50 & seclass <= 60) | (seclass == 32) | (seclass == 41 ) ) & treat == 1 & year == 2000
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2000
mfx
svy : logit CP30 income_thu  if year == 2000
mfx

restore 

preserve

keep if ((seclass >= 50 & seclass <= 60) | (seclass == 32) | (seclass == 41 ) ) & treat == 1 & year == 2004
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2004
mfx
svy : logit CP30 income_thu  if year == 2004
mfx

restore

*=== Economically inactive households ===*

preserve

keep if seclass == 71 & treat == 1 & year == 2000
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2000
mfx
svy : logit CP30 income_thu  if year == 2000
mfx

restore 
preserve

keep if seclass == 71 & treat == 1 & year == 2004
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2004
mfx
svy : logit CP30 income_thu  if year == 2004
mfx

restore

*=== Control ===*

preserve
keep if treat == 0 & year == 2000
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2000
mfx
svy : logit CP30 income_thu  if year == 2000
mfx


restore 
preserve
keep if treat == 0 & year == 2004
svy : mean CP20 CP30

svy : logit CP20 income_thu  if year == 2004
mfx
svy : logit CP30 income_thu  if year == 2004
mfx

restore


*=============================================================================*
*=== Table 6 & Table A1 ======================================================*
*=============================================================================*

svyset PSU [pw=wgh], strata(metastrata)
sort hhno region chan comm blockno month size type seclass


*=== Farmer ===*

preserve
sort Data_id
keep if ((seclass <= 13 & treat == 1) | treat == 0) 

svyset PSU [pw=wgh], strata(metastrata)

svy : reg income /*
*/  SEC01B SEC02B SEC03B SEC04B SEC05B SEC06B SEC11B SEC12B SEC13B SEC21B SEC32B SEC41B SEC50B SEC60B SEC71B  /*
*/  SEC01A SEC02A SEC03A SEC04A SEC05A SEC06A SEC11A SEC12A SEC13A SEC21A SEC32A SEC41A SEC50A SEC60A SEC71A  /*
*/  SEC01Bc SEC02Bc SEC03Bc SEC04Bc SEC05Bc SEC06Bc SEC11Bc SEC12Bc SEC13Bc SEC21Bc SEC22Bc SEC32Bc SEC41Bc SEC50Bc SEC60Bc SEC71Bc  /*
*/  SEC01Ac SEC02Ac SEC03Ac SEC04Ac SEC05Ac SEC06Ac SEC11Ac SEC12Ac SEC13Ac SEC21Ac SEC22Ac SEC32Ac SEC41Ac SEC50Ac SEC60Ac SEC71Ac  /*
*/  Age0_5 AgeM6_11 AgeF6_11 AgeM12_17 AgeF12_17 AgeM18_Att AgeF18_Att AgeM18_64no AgeF18_64no AgeM18_64Pri AgeF18_64Pri AgeM18_64Sec AgeF18_64Sec AgeM18_64PSec AgeF18_64PSec AgeM65_ AgeF65_  /*
*/  Rain1 Rain2 Rain3 Rain4 Rain5 Rain6 Rain7 Rain8 Rain9 Rain10 Rain11 Rain12 /*
*/  Rain1_2 Rain2_2 Rain3_2 Rain4_2 Rain5_2 Rain6_2 Rain7_2 Rain8_2 Rain9_2 Rain10_2 Rain11_2 Rain12_2 /*
*/  CRain1 CRain2 CRain3 CRain4 CRain5 CRain6 CRain7 CRain8 CRain9 CRain10 CRain11 CRain12 /*
*/  CRain1_2 CRain2_2 CRain3_2 CRain4_2 CRain5_2 CRain6_2 CRain7_2 CRain8_2 CRain9_2 CRain10_2 CRain11_2 CRain12_2 /*
*/  DM2004 /*
*/  chan11 chan12 chan13 chan14 chan15 chan16 chan17 chan18 chan19 chan20 chan21 chan22 chan23 chan24 chan25 chan26 chan27 /*
*/  chan30 chan31 chan32 chan33 chan34 chan35 chan36 chan37 chan39 chan40 chan41 chan42 chan43 chan44 chan45 chan46 chan47 chan48 chan49 /*
*/  chan50 chan51 chan52 chan53 chan54 chan55 chan56 chan57 chan58 chan60 chan61 chan62 chan63 chan64 chan65 chan66 chan67 /* 
*/  chan70 chan71 chan72 chan73 chan74 chan75 chan76 chan77 chan80 chan81 chan82 chan83 chan84 chan85 chan86 chan90 chan91 chan92 chan93 chan94 chan95 chan96

gen permanentry_wgh = /*
*/ _b[SEC01B]*SEC01B + _b[SEC02B]*SEC02B + _b[SEC03B]*SEC03B + _b[SEC04B]*SEC04B + _b[SEC05B]*SEC05B + _b[SEC06B]*SEC06B + /*
*/ _b[SEC11B]*SEC11B + _b[SEC12B]*SEC12B + _b[SEC13B]*SEC13B + _b[SEC21B]*SEC21B + _b[SEC32B]*SEC32B + /*
*/ _b[SEC41B]*SEC41B + _b[SEC50B]*SEC50B + _b[SEC60B]*SEC60B + _b[SEC71B]*SEC71B + /*         
*/ _b[SEC01A]*SEC01A + _b[SEC02A]*SEC02A + _b[SEC03A]*SEC03A + _b[SEC04A]*SEC04A + _b[SEC05A]*SEC05A + _b[SEC06A]*SEC06A + /*
*/ _b[SEC11A]*SEC11A + _b[SEC12A]*SEC12A + _b[SEC13A]*SEC13A + _b[SEC21A]*SEC21A + _b[SEC32A]*SEC32A + /*
*/ _b[SEC41A]*SEC41A + _b[SEC50A]*SEC50A + _b[SEC60A]*SEC60A + _b[SEC71A]*SEC71A + /*   
*/ _b[SEC01Bc]*SEC01Bc + _b[SEC02Bc]*SEC02Bc + _b[SEC03Bc]*SEC03Bc + _b[SEC04Bc]*SEC04Bc + _b[SEC05Bc]*SEC05Bc + _b[SEC06Bc]*SEC06Bc + /*
*/ _b[SEC11Bc]*SEC11Bc + _b[SEC12Bc]*SEC12Bc + _b[SEC13Bc]*SEC13Bc + _b[SEC21Bc]*SEC21Bc + _b[SEC22Bc]*SEC22Bc + _b[SEC32Bc]*SEC32Bc + /*
*/ _b[SEC41Bc]*SEC41Bc + _b[SEC50Bc]*SEC50Bc + _b[SEC60Bc]*SEC60Bc + _b[SEC71Bc]*SEC71Bc + /*         
*/ _b[SEC01Ac]*SEC01Ac + _b[SEC02Ac]*SEC02Ac + _b[SEC03Ac]*SEC03Ac + _b[SEC04Ac]*SEC04Ac + _b[SEC05Ac]*SEC05Ac + _b[SEC06Ac]*SEC06Ac + /*
*/ _b[SEC11Ac]*SEC11Ac + _b[SEC12Ac]*SEC12Ac + _b[SEC13Ac]*SEC13Ac + _b[SEC21Ac]*SEC21Ac + _b[SEC22Ac]*SEC22Ac+ _b[SEC32Ac]*SEC32Ac + /*
*/ _b[SEC41Ac]*SEC41Ac + _b[SEC50Ac]*SEC50Ac + _b[SEC60Ac]*SEC60Ac + _b[SEC71Ac]*SEC71Ac + /*   
*/ _b[Age0_5]*Age0_5 + _b[AgeM6_11]*AgeM6_11 + _b[AgeF6_11]*AgeF6_11 + _b[AgeM12_17]*AgeM12_17 + _b[AgeF12_17]*AgeF12_17 + _b[AgeM18_Att]*AgeM18_Att + _b[AgeF18_Att]*AgeF18_Att +  /*                                    
*/ _b[AgeM18_64no]*AgeM18_64no + _b[AgeF18_64no]*AgeF18_64no + _b[AgeM18_64Pri]*AgeM18_64Pri + _b[AgeF18_64Pri]*AgeF18_64Pri + _b[AgeM18_64Sec]*AgeM18_64Sec + _b[AgeF18_64Sec]*AgeF18_64Sec +  /* 
*/ _b[AgeM18_64PSec]*AgeM18_64PSec + _b[AgeF18_64PSec]*AgeF18_64PSec + _b[AgeM65_]*AgeM65_ + _b[AgeF65_]*AgeF65_ +  /*
*/ _b[chan11]*chan11 + _b[chan12]*chan12 + _b[chan13]*chan13 + _b[chan14]*chan14 + _b[chan15]*chan15 + _b[chan16]*chan16 + _b[chan17]*chan17 + _b[chan18]*chan18 +  /*
*/ _b[chan19]*chan19 + _b[chan20]*chan20 + _b[chan21]*chan21 + _b[chan22]*chan22 + _b[chan23]*chan23 + _b[chan24]*chan24 + _b[chan25]*chan25 + _b[chan26]*chan26 +  /*
*/ _b[chan27]*chan27 + _b[chan30]*chan30 + _b[chan31]*chan31 + _b[chan32]*chan32 + _b[chan33]*chan33 + _b[chan34]*chan34 + _b[chan35]*chan35 + _b[chan36]*chan36 +  /*
*/ _b[chan37]*chan37 + _b[chan39]*chan39 + _b[chan40]*chan40 + _b[chan41]*chan41 + _b[chan42]*chan42 + _b[chan43]*chan43 + _b[chan44]*chan44 + _b[chan45]*chan45 +  /*
*/ _b[chan46]*chan46 + _b[chan47]*chan47 + _b[chan48]*chan48 + _b[chan49]*chan49 + _b[chan50]*chan50 + _b[chan51]*chan51 + _b[chan52]*chan52 + _b[chan53]*chan53 +  /*
*/ _b[chan54]*chan54 + _b[chan55]*chan55 + _b[chan56]*chan56 + _b[chan57]*chan57 + _b[chan58]*chan58 + _b[chan60]*chan60 + _b[chan61]*chan61 + _b[chan62]*chan62 +  /*
*/ _b[chan63]*chan63 + _b[chan64]*chan64 + _b[chan65]*chan65 + _b[chan66]*chan66 + _b[chan67]*chan67 + _b[chan70]*chan70 + _b[chan71]*chan71 + _b[chan72]*chan72 +  /*
*/ _b[chan73]*chan73 + _b[chan74]*chan74 + _b[chan75]*chan75 + _b[chan76]*chan76 + _b[chan77]*chan77 + _b[chan80]*chan80 + _b[chan81]*chan81 + _b[chan82]*chan82 +  /*
*/ _b[chan83]*chan83 + _b[chan84]*chan84 + _b[chan85]*chan85 + _b[chan86]*chan86 + _b[chan90]*chan90 + _b[chan91]*chan91 + _b[chan92]*chan92 + _b[chan93]*chan93 +  /*
*/ _b[chan94]*chan94 + _b[chan95]*chan95 + _b[chan96]*chan96 

gen transitry_wgh = _b[Rain1]*Rain1 + _b[Rain2]*Rain2 + _b[Rain3]*Rain3 + _b[Rain4]*Rain4 + _b[Rain5]*Rain5 + _b[Rain6]*Rain6 + _b[Rain7]*Rain7 + _b[Rain8]*Rain8 +  /*
*/ _b[Rain9]*Rain9 + _b[Rain10]*Rain10 + _b[Rain11]*Rain11 + _b[Rain12]*Rain12 + _b[Rain1_2]*Rain1_2 + _b[Rain2_2]*Rain2_2 + _b[Rain3_2]*Rain3_2 + _b[Rain4_2]*Rain4_2 +  /*
*/ _b[Rain5_2]*Rain5_2 + _b[Rain6_2]*Rain6_2 + _b[Rain7_2]*Rain7_2 + _b[Rain8_2]*Rain8_2 + _b[Rain9_2]*Rain9_2 + _b[Rain10_2]*Rain10_2 + _b[Rain11_2]*Rain11_2 + _b[Rain12_2]*Rain12_2 + /*
*/ _b[CRain1]*CRain1 + _b[CRain2]*CRain2 + _b[CRain3]*CRain3 + _b[CRain4]*CRain4 + _b[CRain5]*CRain5 + _b[CRain6]*CRain6 + _b[CRain7]*CRain7 + _b[CRain8]*CRain8 +  /*
*/ _b[CRain9]*CRain9 + _b[CRain10]*CRain10 + _b[CRain11]*CRain11 + _b[CRain12]*CRain12 + _b[CRain1_2]*CRain1_2 + _b[CRain2_2]*CRain2_2 + _b[CRain3_2]*CRain3_2 + _b[CRain4_2]*CRain4_2 +  /*
*/ _b[CRain5_2]*CRain5_2 + _b[CRain6_2]*CRain6_2 + _b[CRain7_2]*CRain7_2 + _b[CRain8_2]*CRain8_2 + _b[CRain9_2]*CRain9_2 + _b[CRain10_2]*CRain10_2 + _b[CRain11_2]*CRain11_2 + _b[CRain12_2]*CRain12_2 
 
gen uncertainry_wgh = income  - permanentry_wgh - transitry_wgh 

bsweights bsw, reps(400) n(-1) seed(10101) dots
svyset PSU [pw=wgh], vce(bootstrap) bsrweight(bsw*) strata(metastrata)

svy bootstrap :reg saving treat /*
*/ permanentry_wgh c.permanentry_wgh#i.DM2004 c.permanentry_wgh#i.treat c.permanentry_wgh#i.DM2004#i.treat /*
*/ transitry_wgh uncertainry_wgh other_income /*
*/ R1sd R2sd R3sd R4sd R5sd R6sd R7sd R8sd R9sd R10sd R11sd R12sd /*
*/ TAge0_5 TAge6_11 TAge12_17 TAge18_64 TAge65_ CAge0_5 CAge6_11 CAge12_17 CAge18_64 CAge65_ /* 
*/ DM2004 

restore

*/
*=== Enterpreneurs, trade and indusgtry ===*

preserve
keep if ((seclass >= 21 & seclass <= 22) | treat == 0) 
sort Data_id
svyset PSU [pw=wgh], strata(metastrata)

svy : reg income /*
*/  SEC01B SEC02B SEC03B SEC04B SEC05B SEC06B SEC11B SEC12B SEC13B SEC21B SEC32B SEC41B SEC50B SEC60B SEC71B  /*
*/  SEC01A SEC02A SEC03A SEC04A SEC05A SEC06A SEC11A SEC12A SEC13A SEC21A SEC32A SEC41A SEC50A SEC60A SEC71A  /*
*/  SEC01Bc SEC02Bc SEC03Bc SEC04Bc SEC05Bc SEC06Bc SEC11Bc SEC12Bc SEC13Bc SEC21Bc SEC22Bc SEC32Bc SEC41Bc SEC50Bc SEC60Bc SEC71Bc  /*
*/  SEC01Ac SEC02Ac SEC03Ac SEC04Ac SEC05Ac SEC06Ac SEC11Ac SEC12Ac SEC13Ac SEC21Ac SEC22Ac SEC32Ac SEC41Ac SEC50Ac SEC60Ac SEC71Ac  /*
*/  Age0_5 AgeM6_11 AgeF6_11 AgeM12_17 AgeF12_17 AgeM18_Att AgeF18_Att AgeM18_64no AgeF18_64no AgeM18_64Pri AgeF18_64Pri AgeM18_64Sec AgeF18_64Sec AgeM18_64PSec AgeF18_64PSec AgeM65_ AgeF65_  /*
*/  Rain1 Rain2 Rain3 Rain4 Rain5 Rain6 Rain7 Rain8 Rain9 Rain10 Rain11 Rain12 /*
*/  Rain1_2 Rain2_2 Rain3_2 Rain4_2 Rain5_2 Rain6_2 Rain7_2 Rain8_2 Rain9_2 Rain10_2 Rain11_2 Rain12_2 /*
*/  CRain1 CRain2 CRain3 CRain4 CRain5 CRain6 CRain7 CRain8 CRain9 CRain10 CRain11 CRain12 /*
*/  CRain1_2 CRain2_2 CRain3_2 CRain4_2 CRain5_2 CRain6_2 CRain7_2 CRain8_2 CRain9_2 CRain10_2 CRain11_2 CRain12_2 /*
*/  DM2004 /*
*/  chan11 chan12 chan13 chan14 chan15 chan16 chan17 chan18 chan19 chan20 chan21 chan22 chan23 chan24 chan25 chan26 chan27 /*
*/  chan30 chan31 chan32 chan33 chan34 chan35 chan36 chan37 chan39 chan40 chan41 chan42 chan43 chan44 chan45 chan46 chan47 chan48 chan49 /*
*/  chan50 chan51 chan52 chan53 chan54 chan55 chan56 chan57 chan58 chan60 chan61 chan62 chan63 chan64 chan65 chan66 chan67 /* 
*/  chan70 chan71 chan72 chan73 chan74 chan75 chan76 chan77 chan80 chan81 chan82 chan83 chan84 chan85 chan86 chan90 chan91 chan92 chan93 chan94 chan95 chan96

gen permanentry_wgh =  /*
*/ _b[SEC01B]*SEC01B + _b[SEC02B]*SEC02B + _b[SEC03B]*SEC03B + _b[SEC04B]*SEC04B + _b[SEC05B]*SEC05B + _b[SEC06B]*SEC06B + /*
*/ _b[SEC11B]*SEC11B + _b[SEC12B]*SEC12B + _b[SEC13B]*SEC13B + _b[SEC21B]*SEC21B + _b[SEC32B]*SEC32B + /*
*/ _b[SEC41B]*SEC41B + _b[SEC50B]*SEC50B + _b[SEC60B]*SEC60B + _b[SEC71B]*SEC71B + /*         
*/ _b[SEC01A]*SEC01A + _b[SEC02A]*SEC02A + _b[SEC03A]*SEC03A + _b[SEC04A]*SEC04A + _b[SEC05A]*SEC05A + _b[SEC06A]*SEC06A + /*
*/ _b[SEC11A]*SEC11A + _b[SEC12A]*SEC12A + _b[SEC13A]*SEC13A + _b[SEC21A]*SEC21A + _b[SEC32A]*SEC32A + /*
*/ _b[SEC41A]*SEC41A + _b[SEC50A]*SEC50A + _b[SEC60A]*SEC60A + _b[SEC71A]*SEC71A + /*   
*/ _b[SEC01Bc]*SEC01Bc + _b[SEC02Bc]*SEC02Bc + _b[SEC03Bc]*SEC03Bc + _b[SEC04Bc]*SEC04Bc + _b[SEC05Bc]*SEC05Bc + _b[SEC06Bc]*SEC06Bc + /*
*/ _b[SEC11Bc]*SEC11Bc + _b[SEC12Bc]*SEC12Bc + _b[SEC13Bc]*SEC13Bc + _b[SEC21Bc]*SEC21Bc + _b[SEC22Bc]*SEC22Bc + _b[SEC32Bc]*SEC32Bc + /*
*/ _b[SEC41Bc]*SEC41Bc + _b[SEC50Bc]*SEC50Bc + _b[SEC60Bc]*SEC60Bc + _b[SEC71Bc]*SEC71Bc + /*         
*/ _b[SEC01Ac]*SEC01Ac + _b[SEC02Ac]*SEC02Ac + _b[SEC03Ac]*SEC03Ac + _b[SEC04Ac]*SEC04Ac + _b[SEC05Ac]*SEC05Ac + _b[SEC06Ac]*SEC06Ac + /*
*/ _b[SEC11Ac]*SEC11Ac + _b[SEC12Ac]*SEC12Ac + _b[SEC13Ac]*SEC13Ac + _b[SEC21Ac]*SEC21Ac + _b[SEC22Ac]*SEC22Ac+ _b[SEC32Ac]*SEC32Ac + /*
*/ _b[SEC41Ac]*SEC41Ac + _b[SEC50Ac]*SEC50Ac + _b[SEC60Ac]*SEC60Ac + _b[SEC71Ac]*SEC71Ac + /*   
*/ _b[Age0_5]*Age0_5 + _b[AgeM6_11]*AgeM6_11 + _b[AgeF6_11]*AgeF6_11 + _b[AgeM12_17]*AgeM12_17 + _b[AgeF12_17]*AgeF12_17 + _b[AgeM18_Att]*AgeM18_Att + _b[AgeF18_Att]*AgeF18_Att +  /*                                    
*/ _b[AgeM18_64no]*AgeM18_64no + _b[AgeF18_64no]*AgeF18_64no + _b[AgeM18_64Pri]*AgeM18_64Pri + _b[AgeF18_64Pri]*AgeF18_64Pri + _b[AgeM18_64Sec]*AgeM18_64Sec + _b[AgeF18_64Sec]*AgeF18_64Sec +  /* 
*/ _b[AgeM18_64PSec]*AgeM18_64PSec + _b[AgeF18_64PSec]*AgeF18_64PSec + _b[AgeM65_]*AgeM65_ + _b[AgeF65_]*AgeF65_ +  /*
*/ _b[chan11]*chan11 + _b[chan12]*chan12 + _b[chan13]*chan13 + _b[chan14]*chan14 + _b[chan15]*chan15 + _b[chan16]*chan16 + _b[chan17]*chan17 + _b[chan18]*chan18 +  /*
*/ _b[chan19]*chan19 + _b[chan20]*chan20 + _b[chan21]*chan21 + _b[chan22]*chan22 + _b[chan23]*chan23 + _b[chan24]*chan24 + _b[chan25]*chan25 + _b[chan26]*chan26 +  /*
*/ _b[chan27]*chan27 + _b[chan30]*chan30 + _b[chan31]*chan31 + _b[chan32]*chan32 + _b[chan33]*chan33 + _b[chan34]*chan34 + _b[chan35]*chan35 + _b[chan36]*chan36 +  /*
*/ _b[chan37]*chan37 + _b[chan39]*chan39 + _b[chan40]*chan40 + _b[chan41]*chan41 + _b[chan42]*chan42 + _b[chan43]*chan43 + _b[chan44]*chan44 + _b[chan45]*chan45 +  /*
*/ _b[chan46]*chan46 + _b[chan47]*chan47 + _b[chan48]*chan48 + _b[chan49]*chan49 + _b[chan50]*chan50 + _b[chan51]*chan51 + _b[chan52]*chan52 + _b[chan53]*chan53 +  /*
*/ _b[chan54]*chan54 + _b[chan55]*chan55 + _b[chan56]*chan56 + _b[chan57]*chan57 + _b[chan58]*chan58 + _b[chan60]*chan60 + _b[chan61]*chan61 + _b[chan62]*chan62 +  /*
*/ _b[chan63]*chan63 + _b[chan64]*chan64 + _b[chan65]*chan65 + _b[chan66]*chan66 + _b[chan67]*chan67 + _b[chan70]*chan70 + _b[chan71]*chan71 + _b[chan72]*chan72 +  /*
*/ _b[chan73]*chan73 + _b[chan74]*chan74 + _b[chan75]*chan75 + _b[chan76]*chan76 + _b[chan77]*chan77 + _b[chan80]*chan80 + _b[chan81]*chan81 + _b[chan82]*chan82 +  /*
*/ _b[chan83]*chan83 + _b[chan84]*chan84 + _b[chan85]*chan85 + _b[chan86]*chan86 + _b[chan90]*chan90 + _b[chan91]*chan91 + _b[chan92]*chan92 + _b[chan93]*chan93 +  /*
*/ _b[chan94]*chan94 + _b[chan95]*chan95 + _b[chan96]*chan96 
 
gen transitry_wgh = _b[Rain1]*Rain1 + _b[Rain2]*Rain2 + _b[Rain3]*Rain3 + _b[Rain4]*Rain4 + _b[Rain5]*Rain5 + _b[Rain6]*Rain6 + _b[Rain7]*Rain7 + _b[Rain8]*Rain8 +  /*
*/ _b[Rain9]*Rain9 + _b[Rain10]*Rain10 + _b[Rain11]*Rain11 + _b[Rain12]*Rain12 + _b[Rain1_2]*Rain1_2 + _b[Rain2_2]*Rain2_2 + _b[Rain3_2]*Rain3_2 + _b[Rain4_2]*Rain4_2 +  /*
*/ _b[Rain5_2]*Rain5_2 + _b[Rain6_2]*Rain6_2 + _b[Rain7_2]*Rain7_2 + _b[Rain8_2]*Rain8_2 + _b[Rain9_2]*Rain9_2 + _b[Rain10_2]*Rain10_2 + _b[Rain11_2]*Rain11_2 + _b[Rain12_2]*Rain12_2 + /*
*/ _b[CRain1]*CRain1 + _b[CRain2]*CRain2 + _b[CRain3]*CRain3 + _b[CRain4]*CRain4 + _b[CRain5]*CRain5 + _b[CRain6]*CRain6 + _b[CRain7]*CRain7 + _b[CRain8]*CRain8 +  /*
*/ _b[CRain9]*CRain9 + _b[CRain10]*CRain10 + _b[CRain11]*CRain11 + _b[CRain12]*CRain12 + _b[CRain1_2]*CRain1_2 + _b[CRain2_2]*CRain2_2 + _b[CRain3_2]*CRain3_2 + _b[CRain4_2]*CRain4_2 +  /*
*/ _b[CRain5_2]*CRain5_2 + _b[CRain6_2]*CRain6_2 + _b[CRain7_2]*CRain7_2 + _b[CRain8_2]*CRain8_2 + _b[CRain9_2]*CRain9_2 + _b[CRain10_2]*CRain10_2 + _b[CRain11_2]*CRain11_2 + _b[CRain12_2]*CRain12_2 

gen uncertainry_wgh = income  - permanentry_wgh - transitry_wgh 

bsweights bsw, reps(400) n(-1) seed(10101) dots

svyset PSU [pw=wgh], vce(bootstrap) bsrweight(bsw*) strata(metastrata)


svy bootstrap :reg saving treat /*
*/ permanentry_wgh c.permanentry_wgh#i.DM2004 c.permanentry_wgh#i.treat c.permanentry_wgh#i.DM2004#i.treat /*
*/ transitry_wgh uncertainry_wgh other_income /*
*/ R1sd R2sd R3sd R4sd R5sd R6sd R7sd R8sd R9sd R10sd R11sd R12sd /*
*/ TAge0_5 TAge6_11 TAge12_17 TAge18_64 TAge65_ CAge0_5 CAge6_11 CAge12_17 CAge18_64 CAge65_ /* 
*/ DM2004 

restore
*/
*=== Other work status ===*

preserve
keep if (seclass >= 50 & seclass <= 60 & treat == 1) | (seclass == 32 & treat == 1) | (seclass == 41 & treat == 1)| treat == 0
sort Data_id
svyset PSU [pw=wgh], strata(metastrata)

svy : reg income /*
*/  SEC01B SEC02B SEC03B SEC04B SEC05B SEC06B SEC11B SEC12B SEC13B SEC21B SEC32B SEC41B SEC50B SEC60B SEC71B  /*
*/  SEC01A SEC02A SEC03A SEC04A SEC05A SEC06A SEC11A SEC12A SEC13A SEC21A SEC32A SEC41A SEC50A SEC60A SEC71A  /*
*/  SEC01Bc SEC02Bc SEC03Bc SEC04Bc SEC05Bc SEC06Bc SEC11Bc SEC12Bc SEC13Bc SEC21Bc SEC22Bc SEC32Bc SEC41Bc SEC50Bc SEC60Bc SEC71Bc  /*
*/  SEC01Ac SEC02Ac SEC03Ac SEC04Ac SEC05Ac SEC06Ac SEC11Ac SEC12Ac SEC13Ac SEC21Ac SEC22Ac SEC32Ac SEC41Ac SEC50Ac SEC60Ac SEC71Ac  /*
*/  Age0_5 AgeM6_11 AgeF6_11 AgeM12_17 AgeF12_17 AgeM18_Att AgeF18_Att AgeM18_64no AgeF18_64no AgeM18_64Pri AgeF18_64Pri AgeM18_64Sec AgeF18_64Sec AgeM18_64PSec AgeF18_64PSec AgeM65_ AgeF65_  /*
*/  Rain1 Rain2 Rain3 Rain4 Rain5 Rain6 Rain7 Rain8 Rain9 Rain10 Rain11 Rain12 /*
*/  Rain1_2 Rain2_2 Rain3_2 Rain4_2 Rain5_2 Rain6_2 Rain7_2 Rain8_2 Rain9_2 Rain10_2 Rain11_2 Rain12_2 /*
*/  CRain1 CRain2 CRain3 CRain4 CRain5 CRain6 CRain7 CRain8 CRain9 CRain10 CRain11 CRain12 /*
*/  CRain1_2 CRain2_2 CRain3_2 CRain4_2 CRain5_2 CRain6_2 CRain7_2 CRain8_2 CRain9_2 CRain10_2 CRain11_2 CRain12_2 /*
*/  DM2004 /*
*/  chan11 chan12 chan13 chan14 chan15 chan16 chan17 chan18 chan19 chan20 chan21 chan22 chan23 chan24 chan25 chan26 chan27 /*
*/  chan30 chan31 chan32 chan33 chan34 chan35 chan36 chan37 chan39 chan40 chan41 chan42 chan43 chan44 chan45 chan46 chan47 chan48 chan49 /*
*/  chan50 chan51 chan52 chan53 chan54 chan55 chan56 chan57 chan58 chan60 chan61 chan62 chan63 chan64 chan65 chan66 chan67 /* 
*/  chan70 chan71 chan72 chan73 chan74 chan75 chan76 chan77 chan80 chan81 chan82 chan83 chan84 chan85 chan86 chan90 chan91 chan92 chan93 chan94 chan95 chan96

gen permanentry_wgh = /*
*/ _b[SEC01B]*SEC01B + _b[SEC02B]*SEC02B + _b[SEC03B]*SEC03B + _b[SEC04B]*SEC04B + _b[SEC05B]*SEC05B + _b[SEC06B]*SEC06B + /*
*/ _b[SEC11B]*SEC11B + _b[SEC12B]*SEC12B + _b[SEC13B]*SEC13B + _b[SEC21B]*SEC21B + _b[SEC32B]*SEC32B + /*
*/ _b[SEC41B]*SEC41B + _b[SEC50B]*SEC50B + _b[SEC60B]*SEC60B + _b[SEC71B]*SEC71B + /*         
*/ _b[SEC01A]*SEC01A + _b[SEC02A]*SEC02A + _b[SEC03A]*SEC03A + _b[SEC04A]*SEC04A + _b[SEC05A]*SEC05A + _b[SEC06A]*SEC06A + /*
*/ _b[SEC11A]*SEC11A + _b[SEC12A]*SEC12A + _b[SEC13A]*SEC13A + _b[SEC21A]*SEC21A + _b[SEC32A]*SEC32A + /*
*/ _b[SEC41A]*SEC41A + _b[SEC50A]*SEC50A + _b[SEC60A]*SEC60A + _b[SEC71A]*SEC71A + /*   
*/ _b[SEC01Bc]*SEC01Bc + _b[SEC02Bc]*SEC02Bc + _b[SEC03Bc]*SEC03Bc + _b[SEC04Bc]*SEC04Bc + _b[SEC05Bc]*SEC05Bc + _b[SEC06Bc]*SEC06Bc + /*
*/ _b[SEC11Bc]*SEC11Bc + _b[SEC12Bc]*SEC12Bc + _b[SEC13Bc]*SEC13Bc + _b[SEC21Bc]*SEC21Bc + _b[SEC22Bc]*SEC22Bc + _b[SEC32Bc]*SEC32Bc + /*
*/ _b[SEC41Bc]*SEC41Bc + _b[SEC50Bc]*SEC50Bc + _b[SEC60Bc]*SEC60Bc + _b[SEC71Bc]*SEC71Bc + /*         
*/ _b[SEC01Ac]*SEC01Ac + _b[SEC02Ac]*SEC02Ac + _b[SEC03Ac]*SEC03Ac + _b[SEC04Ac]*SEC04Ac + _b[SEC05Ac]*SEC05Ac + _b[SEC06Ac]*SEC06Ac + /*
*/ _b[SEC11Ac]*SEC11Ac + _b[SEC12Ac]*SEC12Ac + _b[SEC13Ac]*SEC13Ac + _b[SEC21Ac]*SEC21Ac + _b[SEC22Ac]*SEC22Ac+ _b[SEC32Ac]*SEC32Ac + /*
*/ _b[SEC41Ac]*SEC41Ac + _b[SEC50Ac]*SEC50Ac + _b[SEC60Ac]*SEC60Ac + _b[SEC71Ac]*SEC71Ac + /*   
*/ _b[Age0_5]*Age0_5 + _b[AgeM6_11]*AgeM6_11 + _b[AgeF6_11]*AgeF6_11 + _b[AgeM12_17]*AgeM12_17 + _b[AgeF12_17]*AgeF12_17 + _b[AgeM18_Att]*AgeM18_Att + _b[AgeF18_Att]*AgeF18_Att +  /*                                    
*/ _b[AgeM18_64no]*AgeM18_64no + _b[AgeF18_64no]*AgeF18_64no + _b[AgeM18_64Pri]*AgeM18_64Pri + _b[AgeF18_64Pri]*AgeF18_64Pri + _b[AgeM18_64Sec]*AgeM18_64Sec + _b[AgeF18_64Sec]*AgeF18_64Sec +  /* 
*/ _b[AgeM18_64PSec]*AgeM18_64PSec + _b[AgeF18_64PSec]*AgeF18_64PSec + _b[AgeM65_]*AgeM65_ + _b[AgeF65_]*AgeF65_ +  /*
*/ _b[chan11]*chan11 + _b[chan12]*chan12 + _b[chan13]*chan13 + _b[chan14]*chan14 + _b[chan15]*chan15 + _b[chan16]*chan16 + _b[chan17]*chan17 + _b[chan18]*chan18 +  /*
*/ _b[chan19]*chan19 + _b[chan20]*chan20 + _b[chan21]*chan21 + _b[chan22]*chan22 + _b[chan23]*chan23 + _b[chan24]*chan24 + _b[chan25]*chan25 + _b[chan26]*chan26 +  /*
*/ _b[chan27]*chan27 + _b[chan30]*chan30 + _b[chan31]*chan31 + _b[chan32]*chan32 + _b[chan33]*chan33 + _b[chan34]*chan34 + _b[chan35]*chan35 + _b[chan36]*chan36 +  /*
*/ _b[chan37]*chan37 + _b[chan39]*chan39 + _b[chan40]*chan40 + _b[chan41]*chan41 + _b[chan42]*chan42 + _b[chan43]*chan43 + _b[chan44]*chan44 + _b[chan45]*chan45 +  /*
*/ _b[chan46]*chan46 + _b[chan47]*chan47 + _b[chan48]*chan48 + _b[chan49]*chan49 + _b[chan50]*chan50 + _b[chan51]*chan51 + _b[chan52]*chan52 + _b[chan53]*chan53 +  /*
*/ _b[chan54]*chan54 + _b[chan55]*chan55 + _b[chan56]*chan56 + _b[chan57]*chan57 + _b[chan58]*chan58 + _b[chan60]*chan60 + _b[chan61]*chan61 + _b[chan62]*chan62 +  /*
*/ _b[chan63]*chan63 + _b[chan64]*chan64 + _b[chan65]*chan65 + _b[chan66]*chan66 + _b[chan67]*chan67 + _b[chan70]*chan70 + _b[chan71]*chan71 + _b[chan72]*chan72 +  /*
*/ _b[chan73]*chan73 + _b[chan74]*chan74 + _b[chan75]*chan75 + _b[chan76]*chan76 + _b[chan77]*chan77 + _b[chan80]*chan80 + _b[chan81]*chan81 + _b[chan82]*chan82 +  /*
*/ _b[chan83]*chan83 + _b[chan84]*chan84 + _b[chan85]*chan85 + _b[chan86]*chan86 + _b[chan90]*chan90 + _b[chan91]*chan91 + _b[chan92]*chan92 + _b[chan93]*chan93 +  /*
*/ _b[chan94]*chan94 + _b[chan95]*chan95 + _b[chan96]*chan96 
 
gen transitry_wgh = _b[Rain1]*Rain1 + _b[Rain2]*Rain2 + _b[Rain3]*Rain3 + _b[Rain4]*Rain4 + _b[Rain5]*Rain5 + _b[Rain6]*Rain6 + _b[Rain7]*Rain7 + _b[Rain8]*Rain8 +  /*
*/ _b[Rain9]*Rain9 + _b[Rain10]*Rain10 + _b[Rain11]*Rain11 + _b[Rain12]*Rain12 + _b[Rain1_2]*Rain1_2 + _b[Rain2_2]*Rain2_2 + _b[Rain3_2]*Rain3_2 + _b[Rain4_2]*Rain4_2 +  /*
*/ _b[Rain5_2]*Rain5_2 + _b[Rain6_2]*Rain6_2 + _b[Rain7_2]*Rain7_2 + _b[Rain8_2]*Rain8_2 + _b[Rain9_2]*Rain9_2 + _b[Rain10_2]*Rain10_2 + _b[Rain11_2]*Rain11_2 + _b[Rain12_2]*Rain12_2 + /*
*/ _b[CRain1]*CRain1 + _b[CRain2]*CRain2 + _b[CRain3]*CRain3 + _b[CRain4]*CRain4 + _b[CRain5]*CRain5 + _b[CRain6]*CRain6 + _b[CRain7]*CRain7 + _b[CRain8]*CRain8 +  /*
*/ _b[CRain9]*CRain9 + _b[CRain10]*CRain10 + _b[CRain11]*CRain11 + _b[CRain12]*CRain12 + _b[CRain1_2]*CRain1_2 + _b[CRain2_2]*CRain2_2 + _b[CRain3_2]*CRain3_2 + _b[CRain4_2]*CRain4_2 +  /*
*/ _b[CRain5_2]*CRain5_2 + _b[CRain6_2]*CRain6_2 + _b[CRain7_2]*CRain7_2 + _b[CRain8_2]*CRain8_2 + _b[CRain9_2]*CRain9_2 + _b[CRain10_2]*CRain10_2 + _b[CRain11_2]*CRain11_2 + _b[CRain12_2]*CRain12_2 

gen uncertainry_wgh = income  - permanentry_wgh - transitry_wgh 


bsweights bsw, reps(400) n(-1) seed(10101) dots

svyset PSU [pw=wgh], vce(bootstrap) bsrweight(bsw*) strata(metastrata)

svy bootstrap :reg saving treat /*
*/ permanentry_wgh c.permanentry_wgh#i.DM2004 c.permanentry_wgh#i.treat c.permanentry_wgh#i.DM2004#i.treat /*
*/ transitry_wgh uncertainry_wgh other_income /*
*/ R1sd R2sd R3sd R4sd R5sd R6sd R7sd R8sd R9sd R10sd R11sd R12sd /*
*/ TAge0_5 TAge6_11 TAge12_17 TAge18_64 TAge65_ CAge0_5 CAge6_11 CAge12_17 CAge18_64 CAge65_ /* 
*/ DM2004


restore
*/
*=== Economically inactive households ===*


preserve
keep if (seclass == 71 & treat == 1) |  treat == 0
sort Data_id
svyset PSU [pw=wgh], strata(metastrata)

svy : reg income /*
*/  SEC01B SEC02B SEC03B SEC04B SEC05B SEC06B SEC11B SEC12B SEC13B SEC21B SEC32B SEC41B SEC50B SEC60B SEC71B  /*
*/  SEC01A SEC02A SEC03A SEC04A SEC05A SEC06A SEC11A SEC12A SEC13A SEC21A SEC32A SEC41A SEC50A SEC60A SEC71A  /*
*/  SEC01Bc SEC02Bc SEC03Bc SEC04Bc SEC05Bc SEC06Bc SEC11Bc SEC12Bc SEC13Bc SEC21Bc SEC22Bc SEC32Bc SEC41Bc SEC50Bc SEC60Bc SEC71Bc  /*
*/  SEC01Ac SEC02Ac SEC03Ac SEC04Ac SEC05Ac SEC06Ac SEC11Ac SEC12Ac SEC13Ac SEC21Ac SEC22Ac SEC32Ac SEC41Ac SEC50Ac SEC60Ac SEC71Ac  /*
*/  Age0_5 AgeM6_11 AgeF6_11 AgeM12_17 AgeF12_17 AgeM18_Att AgeF18_Att AgeM18_64no AgeF18_64no AgeM18_64Pri AgeF18_64Pri AgeM18_64Sec AgeF18_64Sec AgeM18_64PSec AgeF18_64PSec AgeM65_ AgeF65_  /*
*/  Rain1 Rain2 Rain3 Rain4 Rain5 Rain6 Rain7 Rain8 Rain9 Rain10 Rain11 Rain12 /*
*/  Rain1_2 Rain2_2 Rain3_2 Rain4_2 Rain5_2 Rain6_2 Rain7_2 Rain8_2 Rain9_2 Rain10_2 Rain11_2 Rain12_2 /*
*/  CRain1 CRain2 CRain3 CRain4 CRain5 CRain6 CRain7 CRain8 CRain9 CRain10 CRain11 CRain12 /*
*/  CRain1_2 CRain2_2 CRain3_2 CRain4_2 CRain5_2 CRain6_2 CRain7_2 CRain8_2 CRain9_2 CRain10_2 CRain11_2 CRain12_2 /*
*/  DM2004 /*
*/  chan11 chan12 chan13 chan14 chan15 chan16 chan17 chan18 chan19 chan20 chan21 chan22 chan23 chan24 chan25 chan26 chan27 /*
*/  chan30 chan31 chan32 chan33 chan34 chan35 chan36 chan37 chan39 chan40 chan41 chan42 chan43 chan44 chan45 chan46 chan47 chan48 chan49 /*
*/  chan50 chan51 chan52 chan53 chan54 chan55 chan56 chan57 chan58 chan60 chan61 chan62 chan63 chan64 chan65 chan66 chan67 /* 
*/  chan70 chan71 chan72 chan73 chan74 chan75 chan76 chan77 chan80 chan81 chan82 chan83 chan84 chan85 chan86 chan90 chan91 chan92 chan93 chan94 chan95 chan96

 gen permanentry_wgh = /*
*/ _b[SEC01B]*SEC01B + _b[SEC02B]*SEC02B + _b[SEC03B]*SEC03B + _b[SEC04B]*SEC04B + _b[SEC05B]*SEC05B + _b[SEC06B]*SEC06B + /*
*/ _b[SEC11B]*SEC11B + _b[SEC12B]*SEC12B + _b[SEC13B]*SEC13B + _b[SEC21B]*SEC21B + _b[SEC32B]*SEC32B + /*
*/ _b[SEC41B]*SEC41B + _b[SEC50B]*SEC50B + _b[SEC60B]*SEC60B + _b[SEC71B]*SEC71B + /*         
*/ _b[SEC01A]*SEC01A + _b[SEC02A]*SEC02A + _b[SEC03A]*SEC03A + _b[SEC04A]*SEC04A + _b[SEC05A]*SEC05A + _b[SEC06A]*SEC06A + /*
*/ _b[SEC11A]*SEC11A + _b[SEC12A]*SEC12A + _b[SEC13A]*SEC13A + _b[SEC21A]*SEC21A + _b[SEC32A]*SEC32A + /*
*/ _b[SEC41A]*SEC41A + _b[SEC50A]*SEC50A + _b[SEC60A]*SEC60A + _b[SEC71A]*SEC71A + /*   
*/ _b[SEC01Bc]*SEC01Bc + _b[SEC02Bc]*SEC02Bc + _b[SEC03Bc]*SEC03Bc + _b[SEC04Bc]*SEC04Bc + _b[SEC05Bc]*SEC05Bc + _b[SEC06Bc]*SEC06Bc + /*
*/ _b[SEC11Bc]*SEC11Bc + _b[SEC12Bc]*SEC12Bc + _b[SEC13Bc]*SEC13Bc + _b[SEC21Bc]*SEC21Bc + _b[SEC22Bc]*SEC22Bc + _b[SEC32Bc]*SEC32Bc + /*
*/ _b[SEC41Bc]*SEC41Bc + _b[SEC50Bc]*SEC50Bc + _b[SEC60Bc]*SEC60Bc + _b[SEC71Bc]*SEC71Bc + /*         
*/ _b[SEC01Ac]*SEC01Ac + _b[SEC02Ac]*SEC02Ac + _b[SEC03Ac]*SEC03Ac + _b[SEC04Ac]*SEC04Ac + _b[SEC05Ac]*SEC05Ac + _b[SEC06Ac]*SEC06Ac + /*
*/ _b[SEC11Ac]*SEC11Ac + _b[SEC12Ac]*SEC12Ac + _b[SEC13Ac]*SEC13Ac + _b[SEC21Ac]*SEC21Ac + _b[SEC22Ac]*SEC22Ac+ _b[SEC32Ac]*SEC32Ac + /*
*/ _b[SEC41Ac]*SEC41Ac + _b[SEC50Ac]*SEC50Ac + _b[SEC60Ac]*SEC60Ac + _b[SEC71Ac]*SEC71Ac + /*   
*/ _b[Age0_5]*Age0_5 + _b[AgeM6_11]*AgeM6_11 + _b[AgeF6_11]*AgeF6_11 + _b[AgeM12_17]*AgeM12_17 + _b[AgeF12_17]*AgeF12_17 + _b[AgeM18_Att]*AgeM18_Att + _b[AgeF18_Att]*AgeF18_Att +  /*                                    
*/ _b[AgeM18_64no]*AgeM18_64no + _b[AgeF18_64no]*AgeF18_64no + _b[AgeM18_64Pri]*AgeM18_64Pri + _b[AgeF18_64Pri]*AgeF18_64Pri + _b[AgeM18_64Sec]*AgeM18_64Sec + _b[AgeF18_64Sec]*AgeF18_64Sec +  /* 
*/ _b[AgeM18_64PSec]*AgeM18_64PSec + _b[AgeF18_64PSec]*AgeF18_64PSec + _b[AgeM65_]*AgeM65_ + _b[AgeF65_]*AgeF65_ +  /*
*/ _b[chan11]*chan11 + _b[chan12]*chan12 + _b[chan13]*chan13 + _b[chan14]*chan14 + _b[chan15]*chan15 + _b[chan16]*chan16 + _b[chan17]*chan17 + _b[chan18]*chan18 +  /*
*/ _b[chan19]*chan19 + _b[chan20]*chan20 + _b[chan21]*chan21 + _b[chan22]*chan22 + _b[chan23]*chan23 + _b[chan24]*chan24 + _b[chan25]*chan25 + _b[chan26]*chan26 +  /*
*/ _b[chan27]*chan27 + _b[chan30]*chan30 + _b[chan31]*chan31 + _b[chan32]*chan32 + _b[chan33]*chan33 + _b[chan34]*chan34 + _b[chan35]*chan35 + _b[chan36]*chan36 +  /*
*/ _b[chan37]*chan37 + _b[chan39]*chan39 + _b[chan40]*chan40 + _b[chan41]*chan41 + _b[chan42]*chan42 + _b[chan43]*chan43 + _b[chan44]*chan44 + _b[chan45]*chan45 +  /*
*/ _b[chan46]*chan46 + _b[chan47]*chan47 + _b[chan48]*chan48 + _b[chan49]*chan49 + _b[chan50]*chan50 + _b[chan51]*chan51 + _b[chan52]*chan52 + _b[chan53]*chan53 +  /*
*/ _b[chan54]*chan54 + _b[chan55]*chan55 + _b[chan56]*chan56 + _b[chan57]*chan57 + _b[chan58]*chan58 + _b[chan60]*chan60 + _b[chan61]*chan61 + _b[chan62]*chan62 +  /*
*/ _b[chan63]*chan63 + _b[chan64]*chan64 + _b[chan65]*chan65 + _b[chan66]*chan66 + _b[chan67]*chan67 + _b[chan70]*chan70 + _b[chan71]*chan71 + _b[chan72]*chan72 +  /*
*/ _b[chan73]*chan73 + _b[chan74]*chan74 + _b[chan75]*chan75 + _b[chan76]*chan76 + _b[chan77]*chan77 + _b[chan80]*chan80 + _b[chan81]*chan81 + _b[chan82]*chan82 +  /*
*/ _b[chan83]*chan83 + _b[chan84]*chan84 + _b[chan85]*chan85 + _b[chan86]*chan86 + _b[chan90]*chan90 + _b[chan91]*chan91 + _b[chan92]*chan92 + _b[chan93]*chan93 +  /*
*/ _b[chan94]*chan94 + _b[chan95]*chan95 + _b[chan96]*chan96 

 
gen transitry_wgh = _b[Rain1]*Rain1 + _b[Rain2]*Rain2 + _b[Rain3]*Rain3 + _b[Rain4]*Rain4 + _b[Rain5]*Rain5 + _b[Rain6]*Rain6 + _b[Rain7]*Rain7 + _b[Rain8]*Rain8 +  /*
*/ _b[Rain9]*Rain9 + _b[Rain10]*Rain10 + _b[Rain11]*Rain11 + _b[Rain12]*Rain12 + _b[Rain1_2]*Rain1_2 + _b[Rain2_2]*Rain2_2 + _b[Rain3_2]*Rain3_2 + _b[Rain4_2]*Rain4_2 +  /*
*/ _b[Rain5_2]*Rain5_2 + _b[Rain6_2]*Rain6_2 + _b[Rain7_2]*Rain7_2 + _b[Rain8_2]*Rain8_2 + _b[Rain9_2]*Rain9_2 + _b[Rain10_2]*Rain10_2 + _b[Rain11_2]*Rain11_2 + _b[Rain12_2]*Rain12_2 + /*
*/ _b[CRain1]*CRain1 + _b[CRain2]*CRain2 + _b[CRain3]*CRain3 + _b[CRain4]*CRain4 + _b[CRain5]*CRain5 + _b[CRain6]*CRain6 + _b[CRain7]*CRain7 + _b[CRain8]*CRain8 +  /*
*/ _b[CRain9]*CRain9 + _b[CRain10]*CRain10 + _b[CRain11]*CRain11 + _b[CRain12]*CRain12 + _b[CRain1_2]*CRain1_2 + _b[CRain2_2]*CRain2_2 + _b[CRain3_2]*CRain3_2 + _b[CRain4_2]*CRain4_2 +  /*
*/ _b[CRain5_2]*CRain5_2 + _b[CRain6_2]*CRain6_2 + _b[CRain7_2]*CRain7_2 + _b[CRain8_2]*CRain8_2 + _b[CRain9_2]*CRain9_2 + _b[CRain10_2]*CRain10_2 + _b[CRain11_2]*CRain11_2 + _b[CRain12_2]*CRain12_2 

gen uncertainry_wgh = income  - permanentry_wgh - transitry_wgh 


bsweights bsw, reps(400) n(-1) seed(10101) dots

svyset PSU [pw=wgh], vce(bootstrap) bsrweight(bsw*) strata(metastrata)

svy bootstrap :reg saving treat /*
*/ permanentry_wgh c.permanentry_wgh#i.DM2004 c.permanentry_wgh#i.treat c.permanentry_wgh#i.DM2004#i.treat /*
*/ transitry_wgh uncertainry_wgh other_income /*
*/ R1sd R2sd R3sd R4sd R5sd R6sd R7sd R8sd R9sd R10sd R11sd R12sd /*
*/ TAge0_5 TAge6_11 TAge12_17 TAge18_64 TAge65_ CAge0_5 CAge6_11 CAge12_17 CAge18_64 CAge65_ /* 
*/ DM2004































